/**	
 * Title: CSE 5322 - Software Design Patterns
 * Description: 
 * Copyright: Copyright (c) UT Arlington, 2011
 * @author: Duy Nguyen(duyanh@uta.edu), Vivek Maheshwari(vivekm@uta.edu), Arjun Satish(arjun.satish@mavs.uta.edu), Lakshmana Srinivasa(lakshmana.srinivasa@mavs.uta.edu), Ismat Jahan(ismat.jahan@mavs.uta.edu)
 * @version 1.0
 */
package edu.uta.cse5322_2011_team3;

import java.util.ArrayList;

import javax.swing.JTextPane;


public class ColorDocument extends Document {
	ArrayList<Phrase> phrases;

    ColorDocument(Document document){
        super(document);
    }
    ColorDocument(String content){
        super(content);
    }
    
    public ArrayList<Phrase> getPhrases() {
        return phrases;
    }

    public void setPhrases(ArrayList<Phrase> phrases, JTextPane textArea) {
        this.phrases = phrases;

        //textArea.setText("");
        //textArea.append(Color.red, "VIVEKM");
        //textArea.changeSelectedColor(Color.red);
        //pane.append(Color.red, String.valueOf(n) + ' ');

//        for(Phrase  ph :this.phrases ) {
//            if(ph instanceof Verb) {
//                String value = ph.getContent();
//                System.out.println("Verb: " +value);
//            } else if(ph instanceof Noun) {
//                String value = ph.getContent();
//                System.out.println("Noun: " +value);
//            }
//
//        }
    }

    @Override
    public String getContent(){
        String s = content;
        for(Phrase p : phrases){
        	 s.replaceAll(p.getContent(), (new ColorPhrase(p)).getContent());
        }
        return s;
    }
    public void color(Phrase[] phrases){
        
    }
}
